<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.rapid-framework.org.cn/rapid" prefix="rapid" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"  %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<rapid:override name="frame-header-style">
 <style>
        /*覆盖 layui*/
        .layui-table {
            margin-top: 0;
        }
    </style>
</rapid:override>
<rapid:override name="frame-content"> 
        <div style="padding: 15px;">
            <blockquote class="layui-elem-quote">
        <span class="layui-breadcrumb" lay-separator="/">
              <a href="/admin">首页</a>
              <a><cite>评论列表</cite></a>
        </span>
    </blockquote>
    <div class="layui-tab layui-tab-card">
    	<form id="form" action="${pageUrlPrefix}1" method="post" name="form"></form>
        <table class="layui-table" lay-even lay-skin="nob">
            <colgroup>
                <col width="100">
                <col width="300">
                <col width=200">
                <col width="150">
                <col width="50">
            </colgroup>
            <thead>
            <tr>
                <th>作者</th>
                <th>评论内容</th>
                <th>回复至</th>
                <th>提交于</th>
                <th>ID</th>
            </tr>
            </thead>
            <tbody>
			<c:forEach var="c" items="${ pageInfo.list}">
            <tr>
                    <td>
                        <img src="${c.commentAuthorAvatar }" alt="" width="64px">
                        <strong>${c.commentAuthorName }</strong>
                        <br>
                           	${c.commentAuthorUrl }<br>${c.commentAuthorEmail }<br>${c.commentIp }</td>
                    <td class="dashboard-comment-wrap">
                    <c:if test="${c.commentPid!=0 }"><span class="at">@ </span></c:if>
                        <a href="https://liuyanzhao.com">${c.commentPname }</a>
                       	${c.commentContent }<div class="">
                                     <span class="">
                                        <a href="comment/reply/${c.commentId }">  回复</a>
                                     </span>
                            <c:if test="${c.commentRole==1 }">
										<span class=""> | 
											<a href="comment/edit/${c.commentId }">编辑</a>
										</span> 
									</c:if>
                            <span class=""> |
                                        <a href="javascript:void(0)" onclick="deleteComment('${c.commentId }')">删除</a>
                                     </span>
                        </div>
                    </td>
                    <td>
                       <a href="article/${c.article.articleId}" target="_blank">${c.article.articleTitle }</a>
                    </td>
                    <td><fmt:formatDate value="${c.commentCreateTime }" pattern="yyyy年MM月dd日 hh时mm分"/></td>
                    <td>${c.commentId }</td>

                </tr>
  
   			</c:forEach>       
            </tbody>

        </table>


    </div>
<%@ include file="../page.jsp" %>

</div>
</rapid:override>
<rapid:override name="frame-footer-script">
				<script>
				//删除文章
				function deleteComment(id) {
				    if(confirmDelete()==true){
				        $.ajax({
				            async: false,
				            type: "POST",
				            url:'comment/delete/'+id,
				            contentType : "application/x-www-form-urlencoded; charset=utf-8",
				            dataType: "text",
				            complete:function () {
				                window.location.reload();
				            }
				        })
				    }
				}
				</script>
</rapid:override>
<%@ include file="../framework.jsp" %>